<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * verify login - security
 * @author: Jose Palala
 * created: 08/25/202
 **/

class Sponsors_db extends Model {

    public function __construct()
    {
		parent::__construct();
		//$this->userdb = $this->load->database();
	}
    
    
	//assumes password is in tri-md5 encrypted already
	function is_sponsor($username,$password)
    {
 		if(isset($_SESSION['username'])) 
		{
			$username = $_SESSION['username'];
			return $username;
		}
		
    	$q1 = $this->db->where('username', $username)->where('password', $password)->limit(1)->get('sponsors');
    		
    	if ($q1->num_rows > 0) {
    		return $q1->row();
    	} else {
			return false;
        }		
    }
	
	public function getAffectedRows()
	{
		return $this->db->affected_rows();
	}

}
/*
	File: sponsors_db
	A model for sponsors login
*/